package com.tangr.adapterapplication;

import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ScaleDrawable;

/**
 * Created by tangr on 2016/11/3.
 */

public class ScaleAlphaDrawable extends ScaleDrawable{
    public ScaleAlphaDrawable(Drawable drawable, int gravity, float scaleWidth, float scaleHeight) {
        super(drawable, gravity, scaleWidth, scaleHeight);
    }

    @Override
    protected void onBoundsChange(Rect bounds) {
        super.onBoundsChange(bounds);
        int level = getLevel();
        this.setAlpha(level*255/10000);
    }
}
